package com.beardedcoder.utils.ui.view;


import com.beardedcoder.lowPower.R;
import com.beardedcoder.lowPower.app.AppSettings;
import com.beardedcoder.lowPower.app.AppSettings.LogLevel;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;

public class SliderView extends View {
	
	private int sliderValueMinimum = 1;
	private int sliderValueMaximum = 100;
	private int sliderValueInterval = 1;
	
	public SliderView(Context context) {
		super(context);
		AppSettings.log(this.getClass(), "SliderView (Constructor)", "class being constructed");
	}
	
	public SliderView(Context context, AttributeSet attrs) {
		super(context, attrs);
		setXMLDefaults(attrs, context);
		AppSettings.log(this.getClass(), "SliderView (Constructor)", "class being constructed");
	}
	
	public SliderView(Context context, AttributeSet attrs, int defStyle) {
		 super(context, attrs, defStyle);
		 setXMLDefaults(attrs, context);
		 AppSettings.log(this.getClass(), "SliderView (Constructor)", "class being constructed");
	}
	
	private void setXMLDefaults(AttributeSet attrs, Context c)
	{
		try{
			TypedArray a = c.obtainStyledAttributes(attrs,R.styleable.PreferenceSeekBarXML);
			sliderValueMinimum = a.getInt(R.styleable.PreferenceSeekBarXML_sliderMin, sliderValueMinimum);
			sliderValueInterval = a.getInt(R.styleable.PreferenceSeekBarXML_increment, sliderValueInterval);
			sliderValueMaximum = a.getInt(R.styleable.PreferenceSeekBarXML_sliderMax, sliderValueMaximum) - sliderValueMinimum;
			
		}catch (Exception e){
			AppSettings.log(this.getClass(), "setXMLDefaults", e.getStackTrace().toString(), LogLevel.error);
		}
	}
	
	

}
